package com.bugreport.utils;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.unitils.UnitilsJUnit4;
import org.unitils.spring.annotation.SpringApplicationContext;
import org.unitils.spring.annotation.SpringBeanByType;

import com.bugreport.utils.MessageFactory;

@SpringApplicationContext("spring-message-factory.xml")
public class MessageFactoryTestCase extends UnitilsJUnit4 {

	@SpringBeanByType
	private MessageFactory factory;

	@Test
	public void getWebSiteUrl() {
		assertEquals("www.bugreport.com", factory.getMessage("website.url"));
	}

	@Test
	public void wellFormatedMessage() {
		String message = factory.getMessage("301", "foo.bar");
		assertEquals("Unable to successfully invoke Axis remote service at 'foo.bar'.", message);
	}
}
